package com.nbsaas.boot.marketing.data.entity;

import com.nbsaas.boot.code.annotation.*;
import com.nbsaas.boot.jpa.data.entity.AbstractEntity;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import lombok.Data;
import org.hibernate.annotations.Comment;

import java.math.BigDecimal;

@CreateByUser
@ComposeView
@Data
@FormAnnotation(title = "活动商品", model = "活动商品")
@Entity
@Table(name = "bs_promotion_product")
@Comment("活动商品关联表")
public class PromotionProduct extends AbstractEntity {

    @Comment("活动ID")
    @SearchItem(name = "promotionId", key = "promotionId", label = "活动ID")
    @FormField(title = "活动ID", sortNum = "1", grid = true, required = true)
    @Column(nullable = false)
    private Long promotionId;

    @Comment("商品ID")
    @SearchItem(name = "productId", key = "productId", label = "商品ID")
    @FormField(title = "商品ID", sortNum = "2", grid = true, required = true)
    @Column(nullable = false)
    private Long productId;

    @Comment("SKU ID")
    @FormField(title = "SKU ID", sortNum = "3", grid = true)
    private Long skuId;

    @Comment("折扣类型")
    @FormField(title = "折扣类型", sortNum = "4", grid = true, type = InputType.select, option = "discount_type")
    @Column(length = 20)
    private String discountType;

    @Comment("折扣值")
    @FormField(title = "折扣值", sortNum = "5", grid = true, type = InputType.el_input_number)
    @Column(precision = 10, scale = 2)
    private BigDecimal discountValue;

    @Comment("原价")
    @FormField(title = "原价", sortNum = "6", grid = true, type = InputType.el_input_number)
    @Column(precision = 10, scale = 2)
    private BigDecimal originalPrice;

    @Comment("促销价")
    @FormField(title = "促销价", sortNum = "7", grid = true, type = InputType.el_input_number)
    @Column(precision = 10, scale = 2)
    private BigDecimal promotionPrice;

    @Comment("库存限制")
    @FormField(title = "库存限制", sortNum = "8", grid = true, type = InputType.el_input_number)
    private Integer stockLimit;

    @Comment("已售数量")
    @FormField(title = "已售数量", sortNum = "9", grid = true, type = InputType.el_input_number)
    private Integer soldCount;
} 